package com.imooc.dao;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.imooc.bean.Message;

/**
* Created By lijiliang on 2018年7月30日 下午9:54:22
*/
public class MessageDao extends SqlSessionDaoSupport{
	/**
	 * 根据查询条件查询消息列表
	 */
	public List<Message> queryMessageList(Map<String,Object> parameter){
		List<Message> messageList = new ArrayList<>();
		SqlSession sqlSession = null ;
			sqlSession = this.getSqlSession();
			IMessage imessage = sqlSession.getMapper(IMessage.class);
			messageList = imessage.queryMessageList(parameter);
		
		return messageList;
	}
	
	/**
	 * 根据查询条件查询消息列表的条数
	 */
	public int count(Message message) {
		int result=0;
		SqlSession sqlSession = null;
			sqlSession = this.getSqlSession();
			IMessage imessage = sqlSession.getMapper(IMessage.class);
			result=imessage.count(message);
		
		return result;
	}
}
